home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / 4D Externals / Timers / timers read me next >
Encoding:
Text File  |  1992-06-15  |  1.8 KB  |  23 lines  |  [TEXT/ttxt]

  1. This package is useful for getting inside critical loops and timing individual lines of code.
  2.  
  3. I've found it useful when dealing with database manipulations in multiuser, and even more so when trying to figure out how to optimize code that does a lot of manipulation of modules.
  4.  
  5. Is it faster to delete the current offscreen area and create a new one? Or should you procedurally clear out the current one and reuse it?
  6.  
  7. Find out!
  8.  
  9. These routines use the revised Time Manager, which is only available under system software 6.0.3 and later (works fine under System 7).
  10.  
  11. The timers try to estimate the overhead in the Time Manager traps, and subtract that out, but this is just an approximation and there is no way for the external to estimate 4D's overhead in calling it.
  12.  
  13. Remember to look at multiple timings of any statement. Execution speed can be affected by many variables, including whether the routines being called are in the processor cache, out in RAM, or only on disk, and what is happening in the background.
  14.  
  15. TimerUSStart - starts the timer running in microseconds, finest resolution is 20 microseconds, much depends on your model Mac, will clock up to about 30 seconds, after that TimerStop just returns 0, cancels any outstanding timer.
  16.  
  17. TimerMSStart - starts the timer running in milliseconds, will clock up to about 18 hours, after that TimerStop just returns 0, cancels any outstanding timer.
  18.  
  19. $elapsed:=TimerStop - returns elapsed time as a longint, in milli or microseconds, depending on the last timer started, cancels the current timer, if no timer is running, just returns 0.
  20.  
  21. If you wish to modify and compile this under Think C 5.0, all you need to do is create a project that includes this file and MacTraps, set the project type: code resource, file type PEXT, creator 4DMX, name Timers, type 4DPX, ID 15001, attrs 20, no custom header.
  22.  
  23.